package com.neuedu.shop.service.impl;

import com.neuedu.shop.entity.User;
import com.neuedu.shop.mapper.UserMapper;
import com.neuedu.shop.service.UserService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author BL
 * @since 2021-04-10
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public void updateUserStatus(User user) {
       /* //从前端传过来的user的状态，如果是1，改为0，如果是0，改为1.
        Integer uStatus = user.getUserStatus();
        //判断状态值
        user.setUserStatus(uStatus==1?0:1);*/
        //将上边的步骤的简化
        //从前端传过来的user的状态，如果是1，改为0，如果是0，改为1.
        //判断状态值
        user.setUserStatus(user.getUserStatus()==1?0:1);
        userMapper.updateUserStatus(user);


    }
}
